// Compiler family
{$IFDEF FPC}
 {$MODE DELPHI}
 {$ASMMODE Intel}

 {$MODESWITCH ALLOWINLINE+}
 {$MODESWITCH DEFAULTPARAMETERS+}
 {$MODESWITCH OUT+}
 {$MODESWITCH ANSISTRINGS+}
 {$MODESWITCH INITFINAL+}
 {$MODESWITCH AUTODEREF+}
 {$MODESWITCH PCHARTOSTRING+}
 {$MODESWITCH RESULT+}
 {$MODESWITCH OBJPAS+}     

 {$MODESWITCH CVAR-}
 {$MODESWITCH NESTEDCOMMENTS-}
{$ELSE}
 {$DEFINE BORLAND}

 {$IFDEF WIN32}
  {$DEFINE MSWINDOWS}
 {$ENDIF}
 
 {$IFDEF MSWINDOWS}
  {$DEFINE DELPHI}
 {$ELSE}
  {$IFDEF LINUX}
   {$DEFINE KYLIX}
  {$ENDIF}
 {$ENDIF}
{$ENDIF}



// CPU word length
{$IFDEF BORLAND}
 {$IFNDEF CLR}
  {$IFDEF CPUX64}
   {$DEFINE CPU64}
  {$ELSE}
   {$DEFINE CPU32}
  {$ENDIF}
 {$ENDIF}
{$ENDIF}

{$IFDEF CPUASM}
 {$IFDEF CPU32} {$DEFINE ASM32} {$ENDIF}
 {$IFDEF CPU64} {$DEFINE ASM64} {$ENDIF}
{$ELSE}
 {$UNDEF ASM32}
 {$UNDEF ASM64}
{$ENDIF}

// Compiler features
{$DEFINE UNKNOWN_COMPILER}

{$IFDEF KYLIX}
 {$DEFINE COMPILER6}
 {$UNDEF UNKNOWN_COMPILER}
{$ELSE}
 {$IFDEF VER80}
  {$DEFINE COMPILER1}
  {$DEFINE DELPHI1}
  {$UNDEF UNKNOWN_COMPILER}
 {$ENDIF}
 {$IFDEF VER90}
  {$DEFINE COMPILER2}
  {$DEFINE DELPHI2}
  {$UNDEF UNKNOWN_COMPILER}
 {$ENDIF}
 {$IFDEF VER100}
  {$DEFINE COMPILER3}
  {$DEFINE DELPHI3}
  {$UNDEF UNKNOWN_COMPILER}
 {$ENDIF}
 {$IFDEF VER120}
  {$DEFINE COMPILER4}
  {$DEFINE DELPHI4}
  {$UNDEF UNKNOWN_COMPILER}
 {$ENDIF}
 {$IFDEF VER130}
  {$DEFINE COMPILER5}
  {$DEFINE DELPHI5}
  {$UNDEF UNKNOWN_COMPILER}
 {$ENDIF}
 {$IFDEF VER140}
  {$DEFINE COMPILER6}
  {$DEFINE DELPHI6}
  {$UNDEF UNKNOWN_COMPILER}
 {$ENDIF}
 {$IFDEF VER150}
  {$DEFINE COMPILER7}
  {$DEFINE DELPHI7}
  {$UNDEF UNKNOWN_COMPILER}
 {$ENDIF}
 {$IFDEF VER160}
  {$DEFINE COMPILER8}
  {$DEFINE DELPHI8}
  {$UNDEF UNKNOWN_COMPILER}
 {$ENDIF}
 {$IFDEF VER170}
  {$DEFINE COMPILER9}
  {$DEFINE DELPHI2005}
  {$UNDEF UNKNOWN_COMPILER}
 {$ENDIF}
 {$IFDEF VER180}
  {$IFDEF VER185}
   {$DEFINE COMPILER11}
   {$DEFINE DELPHI2007}
  {$ELSE}
   {$DEFINE COMPILER10}
   {$DEFINE DELPHI2006}
  {$ENDIF}
  {$UNDEF UNKNOWN_COMPILER}
 {$ENDIF}
 {$IFDEF VER190}
  {$DEFINE COMPILER11}
  {$DEFINE DELPHI2007}
  {$UNDEF UNKNOWN_COMPILER}
 {$ENDIF}
 {$IFDEF VER200}
  {$DEFINE COMPILER12}
  {$DEFINE DELPHI2009}
  {$UNDEF UNKNOWN_COMPILER}
 {$ENDIF}
 {$IFDEF VER210}
  {$DEFINE COMPILER14}
  {$DEFINE DELPHI2010}
  {$UNDEF UNKNOWN_COMPILER}
 {$ENDIF}
 {$IFDEF VER220}
  {$DEFINE COMPILER15}
  {$DEFINE DELPHIXE}
  {$UNDEF UNKNOWN_COMPILER}
 {$ENDIF}
 {$IFDEF VER230}
  {$DEFINE COMPILER16}
  {$DEFINE DELPHIXE2}
  {$UNDEF UNKNOWN_COMPILER}
 {$ENDIF}
 {$IFDEF VER240}
  {$DEFINE COMPILER17}
  {$DEFINE DELPHIXE3}
  {$UNDEF UNKNOWN_COMPILER}
 {$ENDIF}
 {$IFDEF VER250}
  {$DEFINE COMPILER18}
  {$DEFINE DELPHIXE4}
  {$UNDEF UNKNOWN_COMPILER}
 {$ENDIF}
 {$IFDEF VER260}
  {$DEFINE COMPILER19}
  {$DEFINE DELPHIXE5}
  {$UNDEF UNKNOWN_COMPILER}
 {$ENDIF}
 {$IFDEF VER270}
  {$DEFINE COMPILER20}
  {$DEFINE DELPHIXE6}
  {$UNDEF UNKNOWN_COMPILER}
 {$ENDIF}
{$ENDIF}

{$IFDEF UNKNOWN_COMPILER}
 {$DEFINE COMPILER20}
 {$DEFINE DELPHIXE6}
 {$UNDEF UNKNOWN_COMPILER}
{$ENDIF}

{$IFDEF DELPHIXE6}  {$DEFINE DELPHIXE6_UP}  {$ENDIF}
{$IFDEF DELPHIXE5}  {$DEFINE DELPHIXE5_UP}  {$ENDIF}
{$IFDEF DELPHIXE4}  {$DEFINE DELPHIXE4_UP}  {$ENDIF}
{$IFDEF DELPHIXE3}  {$DEFINE DELPHIXE3_UP}  {$ENDIF}
{$IFDEF DELPHIXE2}  {$DEFINE DELPHIXE2_UP}  {$ENDIF}
{$IFDEF DELPHIXE}   {$DEFINE DELPHIXE_UP}   {$ENDIF}
{$IFDEF DELPHI2010} {$DEFINE DELPHI2010_UP} {$ENDIF}
{$IFDEF DELPHI2009} {$DEFINE DELPHI2009_UP} {$ENDIF}
{$IFDEF DELPHI2007} {$DEFINE DELPHI2007_UP} {$ENDIF}
{$IFDEF DELPHI2006} {$DEFINE DELPHI2006_UP} {$ENDIF}
{$IFDEF DELPHI2005} {$DEFINE DELPHI2005_UP} {$ENDIF}
{$IFDEF DELPHI8}    {$DEFINE DELPHI8_UP}    {$ENDIF}
{$IFDEF DELPHI7}    {$DEFINE DELPHI7_UP}    {$ENDIF}
{$IFDEF DELPHI6}    {$DEFINE DELPHI6_UP}    {$ENDIF}
{$IFDEF DELPHI5}    {$DEFINE DELPHI5_UP}    {$ENDIF}
{$IFDEF DELPHI4}    {$DEFINE DELPHI4_UP}    {$ENDIF}
{$IFDEF DELPHI3}    {$DEFINE DELPHI3_UP}    {$ENDIF}
{$IFDEF DELPHI2}    {$DEFINE DELPHI2_UP}    {$ENDIF}
{$IFDEF DELPHI1}    {$DEFINE DELPHI1_UP}    {$ENDIF}

{$IFDEF DELPHIXE6_UP}  {$DEFINE DELPHIXE5_UP}  {$ENDIF}
{$IFDEF DELPHIXE5_UP}  {$DEFINE DELPHIXE4_UP}  {$ENDIF}
{$IFDEF DELPHIXE4_UP}  {$DEFINE DELPHIXE3_UP}  {$ENDIF}
{$IFDEF DELPHIXE3_UP}  {$DEFINE DELPHIXE2_UP}  {$ENDIF}
{$IFDEF DELPHIXE2_UP}  {$DEFINE DELPHIXE_UP}   {$ENDIF}
{$IFDEF DELPHIXE_UP}   {$DEFINE DELPHI2010_UP} {$ENDIF}
{$IFDEF DELPHI2010_UP} {$DEFINE DELPHI2009_UP} {$ENDIF}
{$IFDEF DELPHI2009_UP} {$DEFINE DELPHI2007_UP} {$ENDIF}
{$IFDEF DELPHI2007_UP} {$DEFINE DELPHI2006_UP} {$ENDIF}
{$IFDEF DELPHI2006_UP} {$DEFINE DELPHI2005_UP} {$ENDIF}
{$IFDEF DELPHI2005_UP} {$DEFINE DELPHI8_UP}    {$ENDIF}
{$IFDEF DELPHI8_UP}    {$DEFINE DELPHI7_UP}    {$ENDIF}
{$IFDEF DELPHI7_UP}    {$DEFINE DELPHI6_UP}    {$ENDIF}
{$IFDEF DELPHI6_UP}    {$DEFINE DELPHI5_UP}    {$ENDIF}
{$IFDEF DELPHI5_UP}    {$DEFINE DELPHI4_UP}    {$ENDIF}
{$IFDEF DELPHI4_UP}    {$DEFINE DELPHI3_UP}    {$ENDIF}
{$IFDEF DELPHI3_UP}    {$DEFINE DELPHI2_UP}    {$ENDIF}
{$IFDEF DELPHI2_UP}    {$DEFINE DELPHI1_UP}    {$ENDIF}

{$IFDEF COMPILER20} {$DEFINE COMPILER20_UP} {$ENDIF}
{$IFDEF COMPILER19} {$DEFINE COMPILER19_UP} {$ENDIF}
{$IFDEF COMPILER18} {$DEFINE COMPILER18_UP} {$ENDIF}
{$IFDEF COMPILER17} {$DEFINE COMPILER17_UP} {$ENDIF}
{$IFDEF COMPILER16} {$DEFINE COMPILER16_UP} {$ENDIF}
{$IFDEF COMPILER15} {$DEFINE COMPILER15_UP} {$ENDIF}
{$IFDEF COMPILER14} {$DEFINE COMPILER14_UP} {$ENDIF}
{$IFDEF COMPILER12} {$DEFINE COMPILER12_UP} {$ENDIF}
{$IFDEF COMPILER11} {$DEFINE COMPILER11_UP} {$ENDIF}
{$IFDEF COMPILER10} {$DEFINE COMPILER10_UP} {$ENDIF}
{$IFDEF COMPILER9}  {$DEFINE COMPILER9_UP}  {$ENDIF}
{$IFDEF COMPILER8}  {$DEFINE COMPILER8_UP}  {$ENDIF}
{$IFDEF COMPILER7}  {$DEFINE COMPILER7_UP}  {$ENDIF}
{$IFDEF COMPILER6}  {$DEFINE COMPILER6_UP}  {$ENDIF}
{$IFDEF COMPILER5}  {$DEFINE COMPILER5_UP}  {$ENDIF}
{$IFDEF COMPILER4}  {$DEFINE COMPILER4_UP}  {$ENDIF}
{$IFDEF COMPILER3}  {$DEFINE COMPILER3_UP}  {$ENDIF}
{$IFDEF COMPILER2}  {$DEFINE COMPILER2_UP}  {$ENDIF}
{$IFDEF COMPILER1}  {$DEFINE COMPILER1_UP}  {$ENDIF}

{$IFDEF COMPILER20_UP} {$DEFINE COMPILER19_UP} {$ENDIF}
{$IFDEF COMPILER19_UP} {$DEFINE COMPILER18_UP} {$ENDIF}
{$IFDEF COMPILER18_UP} {$DEFINE COMPILER17_UP} {$ENDIF}
{$IFDEF COMPILER17_UP} {$DEFINE COMPILER16_UP} {$ENDIF}
{$IFDEF COMPILER16_UP} {$DEFINE COMPILER15_UP} {$ENDIF}
{$IFDEF COMPILER15_UP} {$DEFINE COMPILER14_UP} {$ENDIF}
{$IFDEF COMPILER14_UP} {$DEFINE COMPILER12_UP} {$ENDIF}
{$IFDEF COMPILER12_UP} {$DEFINE COMPILER11_UP} {$ENDIF}
{$IFDEF COMPILER11_UP} {$DEFINE COMPILER10_UP} {$ENDIF}
{$IFDEF COMPILER10_UP} {$DEFINE COMPILER9_UP}  {$ENDIF}
{$IFDEF COMPILER9_UP}  {$DEFINE COMPILER8_UP}  {$ENDIF}
{$IFDEF COMPILER8_UP}  {$DEFINE COMPILER7_UP}  {$ENDIF}
{$IFDEF COMPILER7_UP}  {$DEFINE COMPILER6_UP}  {$ENDIF}
{$IFDEF COMPILER6_UP}  {$DEFINE COMPILER5_UP}  {$ENDIF}
{$IFDEF COMPILER5_UP}  {$DEFINE COMPILER4_UP}  {$ENDIF}
{$IFDEF COMPILER4_UP}  {$DEFINE COMPILER3_UP}  {$ENDIF}
{$IFDEF COMPILER3_UP}  {$DEFINE COMPILER2_UP}  {$ENDIF}
{$IFDEF COMPILER2_UP}  {$DEFINE COMPILER1_UP}  {$ENDIF}

{$IFDEF FPC}
 {$IFDEF VER1_0}
  {$MESSAGE 'FPC compiler is outdated.'}
 {$ELSE}
  {$DEFINE SUPPORTS_WIDECHAR}
  {$DEFINE SUPPORTS_OUTPARAMS}
  {$DEFINE SUPPORTS_WIDESTRING}
  {$DEFINE SUPPORTS_LONGWORD}
  {$DEFINE SUPPORTS_INT64}
  {$DEFINE SUPPORTS_DYNAMICARRAYS}
  {$DEFINE SUPPORTS_DEFAULTPARAMS}
  {$DEFINE SUPPORTS_OVERLOAD}
  {$DEFINE SUPPORTS_SETPEFLAGS}
  {$DEFINE SUPPORTS_VARARGS}
  {$DEFINE SUPPORTS_ENUMVALUE}
  {$DEFINE SUPPORTS_COMPILETIME_MESSAGES}
  {$DEFINE SUPPORTS_INLINE}

  {$IFDEF VER2_2}
   {$DEFINE SUPPORTS_DISPINTERFACE}
   {$DEFINE SUPPORTS_IMPLEMENTS}
   {$DEFINE SUPPORTS_DISPID}
  {$ENDIF}
 {$ENDIF}
{$ELSE}
 {$IFDEF CLR}
  {$DEFINE LSTR_IS_UNICODE}
 {$ENDIF}

 {$IFDEF COMPILER2_UP}
  {$DEFINE SUPPORTS_WIDECHAR}
 {$ENDIF}

 {$IFDEF COMPILER3_UP}
  {$DEFINE SUPPORTS_OUTPARAMS}
  {$DEFINE SUPPORTS_WIDESTRING}
 {$ENDIF}

 {$IFDEF COMPILER4_UP}
  {$DEFINE SUPPORTS_LONGWORD}
  {$DEFINE SUPPORTS_INT64}
  {$DEFINE SUPPORTS_DYNAMICARRAYS}
  {$DEFINE SUPPORTS_DEFAULTPARAMS}
  {$DEFINE SUPPORTS_OVERLOAD}
 {$ENDIF}

 {$IFDEF COMPILER6_UP}
  {$DEFINE SUPPORTS_SETPEFLAGS}
  {$DEFINE SUPPORTS_VARARGS}
  {$DEFINE SUPPORTS_ENUMVALUE}
  {$DEFINE SUPPORTS_COMPILETIME_MESSAGES}
 {$ENDIF}

 {$IFDEF COMPILER7_UP}
  {$DEFINE SUPPORTS_UNSAFE_WARNINGS}
 {$ENDIF}

 {$IFDEF COMPILER9_UP}
  {$DEFINE SUPPORTS_FOR_IN}
  {$DEFINE SUPPORTS_INLINE}
 {$ENDIF}

 {$IFDEF COMPILER12_UP}
  {$IFNDEF CLR}
   {$DEFINE LSTR_IS_UNICODE}
  {$ENDIF}
 {$ENDIF}
{$ENDIF}



// Basic settings
{$ALIGN 4}
{$BOOLEVAL OFF}
{$EXTENDEDSYNTAX ON}
{$IOCHECKS OFF}
{$LONGSTRINGS ON}
{$OVERFLOWCHECKS OFF}
{$RANGECHECKS OFF}
{$STACKFRAMES OFF}
{$TYPEDADDRESS OFF}
{$TYPEINFO OFF}
{$WRITEABLECONST OFF}

{$IFDEF BORLAND}
 {$ALIGN 4}
 {$IMPORTEDDATA OFF}
 {$METHODINFO OFF}
 {$MINENUMSIZE 4}
 {$OBJEXPORTALL OFF}
 {$OPTIMIZATION ON}
 {$REALCOMPATIBILITY OFF}
 {$SAFEDIVIDE OFF}
{$ENDIF}

{$IFDEF FPC}
 {$BITPACKING OFF}
 {$CHECKPOINTER OFF}

 {$CODEALIGN PROC=16}
 {$CODEALIGN JUMP=8}
 {$CODEALIGN LOOP=8}

 {$COPERATORS OFF}
 {$GOTO ON}
 {$INLINE ON}
 {$MACRO OFF}
 {$OPTIMIZATION REGVAR,STACKFRAME,LOOPUNROLL,TAILREC,FASTMATH,REMOVEEMPTYPROCS,DFA,CSE,ASMCSE,LEVEL2}
 {$PACKENUM 4}
 {$PACKRECORDS 4}
 {$SAFEFPUEXCEPTIONS OFF}
 {$SCOPEDENUMS OFF}
 {$S-} // stack checking
{$ENDIF}



// Disable specific hints or warnings
{$HINTS ON}
{$WARNINGS ON}

{$IFDEF BORLAND}
 {$IFDEF COMPILER7_UP}
  {$WARN UNSAFE_TYPE OFF}
  {$WARN UNSAFE_CODE OFF}
  {$WARN UNSAFE_CAST OFF}
 {$ENDIF}
{$ELSE}

{$ENDIF}

{$WARN SYMBOL_PLATFORM OFF}
{$WARN UNIT_PLATFORM OFF}



// Debug/Release switch
{$IFDEF Debug} 
 {$IFDEF MSWINDOWS}
  {$IMAGEBASE $1000000}
 {$ENDIF}

 {$ASSERTIONS ON}
 {$DEBUGINFO ON}

 {$IFDEF BORLAND}
  {$DEFINITIONINFO ON}
  {$LOCALSYMBOLS ON}
 {$ENDIF}
{$ELSE}
 {$ASSERTIONS OFF}
 {$DEBUGINFO OFF}

 {$IFDEF BORLAND}
  {$DEFINITIONINFO OFF}
  {$LOCALSYMBOLS OFF}
 {$ENDIF}
{$ENDIF}